package com.wangshili.sys.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wangshili.common.bo.PageObject;
import com.wangshili.common.exception.ServiceException;
import com.wangshili.pojo.common.vo.JsonResult;
import com.wangshili.pojo.sys.entity.SysLog;
import com.wangshili.sys.service.SysLogService;


/**
 * 日志页面控制层
 * @author Administrator
 *
 */
@Controller
@RequestMapping("/log/")
@ResponseBody
public class SysLogController {
	
	@Autowired
	SysLogService logService;
	
	/**
	 * 日志列表1
	 * @param username 当前用户
	 * @param pageCurrent 当前页码
	 * @return 返回查询后的json格式数据
	 */
	@RequestMapping("doFindPageObjects")
	public JsonResult doFindPageObjects(String username
		,Integer pageCurrent) {
		PageObject<SysLog> pageObject = 
				logService.findSysLogByUserName(username, pageCurrent);
		return new JsonResult(pageObject);
	}
	
	/**
	 * 根据指定id删除
	 * @param ids 传入的id动态数组
	 * @return
	 */
	@RequestMapping("doDeleteObject")
	public JsonResult doDeleteObject(Integer... ids) {
		logService.deleteById(ids);
		return new JsonResult("删除成功");
	}
}
